package com.heboan.hadoop.mr_homework;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class MyMapper extends Mapper<LongWritable, Text, MyBean, NullWritable> {
    MyBean myBean = new MyBean();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String num = value.toString();
        myBean.setN(Integer.parseInt(num));
        context.write(myBean, NullWritable.get());
    }
}
